7 Fonts::Fonts(int fontType
, ResourceMaster
* rescources
){
11 font
= TTF_OpenFont("Fonts/Roboto-Black.ttf", 78);
14 font
= TTF_OpenFont("Fonts/Cirno.ttf", 78);
20 renderer
= rsc
->rendPtr
;
22 SDL_GetWindowSize(rsc
->window
, &windowWidth
, &windowHeight
);
26 Fonts::Fonts(int fontType
, ResourceMaster
* rsc
, SDL_Color color
, std::string words
, int rendering
)
32 font
= TTF_OpenFont("Fonts/Roboto-Black.ttf", 28);
36 loadFont(color
, words
, rendering
);
38 renderer
= rsc
->rendPtr
;
39 SDL_GetWindowSize(rsc
->window
, &windowWidth
, &windowHeight
);
47 void Fonts::changeColor() {
51 void Fonts::loadFont(SDL_Color color
, std::string words
, int rendering
) {
52 SDL_Surface
* textSurface
;
53 //3 for outline, 2 for high, 1 for BG 0 for low, default low
55 textSurface
= TTF_RenderText_Solid(font
, words
.c_str(), color
);
57 else if (rendering
== 1) {
58 textSurface
= TTF_RenderText_Shaded(font
, words
.c_str(), color
, SDL_Color
{ 255,255,255 });
60 else if (rendering
== 2) {
61 textSurface
= TTF_RenderText_Blended(font
, words
.c_str(), color
);
63 else if (rendering
== 3) {
64 TTF_SetFontOutline(font
, 1);
65 textSurface
= TTF_RenderText_Blended(font
, words
.c_str(), color
);
66 TTF_SetFontOutline(font
, 0);
69 textSurface
= TTF_RenderText_Solid(font
, words
.c_str(), color
);
74 if (textSurface
== NULL
) {
75 std::cout
<< TTF_GetError() <<"\n";
77 fontTexture
= SDL_CreateTextureFromSurface(renderer
, textSurface
);
79 SDL_FreeSurface(textSurface
);
82 int Fonts::prcnt(double location
, char axis
) {
85 return location
* windowWidth
;
87 return location
* windowHeight
;
94 void Fonts::updateWindow() {
95 SDL_GetWindowSize(rsc
->window
, &windowWidth
, &windowHeight
);
98 SDL_Texture
* Fonts::getTexture() {
102 SDL_Rect
* Fonts::getPosition() {